﻿/// ****************************************************************************
/// Author:	        Robin Zhu
/// Create Date:	2012-4-17
/// Purpose: 		用户登录会话
/// ****************************************************************************
/// Modify By		Date			Remark
/// Robin           2012-4-26       增加LastActivityDate属性
/// ****************************************************************************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using RB.DataAccess.Attributes;

namespace RB.Web.Security
{
    /// <summary>
    /// 用户登录会话
    /// </summary>
    [DataContract]
    [RB.DataAccess.Attributes.QueryName("UserSession")]
    [RB.DataAccess.Attributes.TableName("UserSession")]
    public class UserSession
    {
        [DataMember]
        public System.Guid UserId { get; set; }

        [DataMember]
        [System.ComponentModel.DataAnnotations.StringLengthAttribute(23)]
        public string Ticket { get; set; }

        [DataMember]
        [System.ComponentModel.DataAnnotations.StringLengthAttribute(50)]
        public string UserName { get; set; }

        [DataMember]
        public DateTime? LoginTime { get; set; }

        [DataMember]
        public DateTime? LogoutTime { get; set; }

        [DataMember]
        [System.ComponentModel.DataAnnotations.StringLengthAttribute(16)]
        public string IPAddress { get; set; }

        [DataMember]
        [System.ComponentModel.DataAnnotations.StringLengthAttribute(100)]
        public string HttpForwarded { get; set; }

        [DataMember]
        public DateTime? LastActivityDate { get; set; }

        [DataMember]
        public bool IsStaff { get; set; }

        [DataMember]
        public string AppCode { get; set; }

        [DataMember]
        [NonField]
        internal string[] Roles { get; set; }

        [DataMember]
        [NonField]
        internal string[] PermissionCodes { get; set; }

        [DataMember]
        [NonField]
        public string NickName { get; set; }
    }
}
